<?php

namespace App\Trip\Train\Seat;

class TrainPassengerSeat
{
    /**
     * 乘客座位描述
     * @param $passenger
     * @return string
     */
    static function seatNoDesc($passenger): string
    {
        $carriage_string = __("车厢");
        $code_string     = __("号");
        $seat_code       = $passenger['seat_code'] ?? '';
        $seat            = $passenger['seat'] ?? '';
        if ($seat && in_array($seat, Seats::TRAIN_BEDS)) {
            $bed              = SeatName::trans($seat);
            $seat_code_string = "{$seat_code}{$code_string}{$bed}";
        } else {
            $seat_code_string = "{$seat_code}{$code_string}";
        }
        return "{$passenger['carriage']}{$carriage_string}{$seat_code_string}";
    }
}